if __name__ == "__main__":
    from squirrel_core.api.api import FrameworkAPI
    a = FrameworkAPI()
    spiders_name = 'itra_runnername'
    a.crawl_debug(
        class_name=spiders_name,
        name_first=spiders_name.split("_")[0],
        name_second=spiders_name.split("_")[1],
        crawl_increment=True,
        # queue_data={"spider_config":{"user_name": "杜璐", "card_num":"511321198612302823", "source": "liupanshui"},"serialNumber":"11112222"}
        # queue_data={"spider_config":{"runner_name": "zhang wei", "crawl_increment": False},"serialNumber":"11112222"}
        queue_data={"spider_config":{"runner_name": "zhang wei", "crawl_increment": False},"serialNumber":"11112222"}
        # queue_data={"spider_config":{"email": "27491350@qq.com", "password": "Lb422258!","runner_id":"5521139"},"serialNumber":"11112222"}
    )
    # import time
    # import requests
    # start = int(time.time())
    # url = "http://1.14.96.163:8021/api/start_spider"
    # # url = "http://127.0.0.1:8021/api/start_spider"
    # # data={"spiderConfig":{"runner_name": "zhang wei", "crawl_increment": False},"serialNumber":"11112222","webType":"itra","crawlerType":"runnername"}
    # data={"spiderConfig":{"user_name": "杜璐", "card_num":"511321198612302823"},"serialNumber":"11112222","webType":"signup","crawlerType":"query"}
    # ss = requests.post(url, json=data, headers={"Content-Type": "application/json"})
    # print(ss.text)
    # t = int(time.time())-start
    # print(f"耗时：{t}")
    # import time
    # while True:
    #     ss=requests.get("http://127.0.0.1:8021/api/heart_beat")
    #     print(ss.text,time.time())
    #     time.sleep(1)
    # import requests
    #
    # url = "https://lps.irunner.mobi/match/apply-search?match_eng=68073c33f310f&app_type=&access_token=518869e04b9a3ac6b603fc4ee8362dd1"
    #
    # boundary = "----WebKitFormBoundaryw5lBv8ld8DimAAxW"
    #
    # body = (
    #     f"--{boundary}\r\n"
    #     'Content-Disposition: form-data; name="id_number"\r\n\r\n'
    #     "520202198204224439\r\n"
    #     f"--{boundary}\r\n"
    #     'Content-Disposition: form-data; name="access_token"\r\n\r\n'
    #     "518869e04b9a3ac6b603fc4ee8362dd1\r\n"
    #     f"--{boundary}--\r\n"
    # ).encode("utf-8")
    #
    # headers = {
    #     "Content-Type": f"multipart/form-data; boundary={boundary}",
    # }
    #
    # data = {"id_number": "520202198204224439", "access_token": "518869e04b9a3ac6b603fc4ee8362dd1"}
    # ss = requests.post(url, data=body, headers=headers)
    # pass

